#!/usr/bin/env python
# -*- coding:utf-8 -*-

import random

def getRandomSet(bits):
    num_set = [chr(i) for i in range(48,58)]
    # char_set = [chr(i) for i in range(97,123)]
    # total_set = char_set + num_set

    value_set = "".join(random.sample(num_set, bits))

    return value_set

def username():
    strings = getRandomSet(4)
    unity_username = "Hh"+strings
    #把用户名称写入unity_username.md文件中
    # w 只能操作写入  r 只能读取   a 向文件追加
    # w+ 可读可写   r+可读可写    a+可读可追加
    # wb+写入进制数据
    # w模式打开文件，如果而文件中有数据，再次写入内容，会把原来的覆盖掉
    file_username = open(r'unity_username.txt', mode='w')
    file_username.write(unity_username)
    return unity_username


if __name__ == '__main__' :
    print(username())
